home *** CD-ROM | disk | FTP | other *** search
- /* ==============
- * V3DDocModel.cc
- * ==============
- */
-
- #include <ctype.h>
- #include <stdio.h>
-
- #include "SiesString.hh"
-
- #include "PedWindow.hh"
- #include "PedChoreGeneric.hh"
- #include "Ped1AppProcess.hh"
- #include "PedApplication.hh"
- #include "PedFSRef.hh"
- #include "PedDataSourceFile.hh"
- #include "PedStreamInputBuffered.hh"
- #include "PedDispenserString.hh"
-
- #include "C3DPort.hh"
- #include "C3DModel.hh"
-
- #include "V3DDocModel.hh"
- #include "V3DPanePort.hh"
-
-
- V3DDocModel::V3DDocModel()
- : /*PedDocument(NULL),*/ mModel(NULL), mPane(NULL), mAnimateChore(NULL)
- {
- mModel = new C3DModel;
- }
-
- V3DDocModel::~V3DDocModel()
- {
- if (mModel) delete mModel;
- }
-
- C3DModel *
- V3DDocModel::Model()
- {
- return mModel;
- }
-
- void
- V3DDocModel::Load()
- {
- if (!mModel || !mFile) return;
- PedDataSourceFile *source = new PedDataSourceFile(*mFile);
- source->autorelease();
- PedStreamInputBuffered *stream = new PedStreamInputBuffered(*source);
- stream->autorelease();
- PedDispenserString *dispenser = new PedDispenserString(*stream);
- dispenser->autorelease();
-
- SiesString string;
- while (dispenser->GetString(string)) {
- long len = string.Length();
- if (len == 0) continue;
- char *str = new char [len + 1];
- string.GetCStr(str, len);
- if (isalpha(str[0])) {
- str++;
- }
- double x, y, z;
- long scanned = sscanf(str, "%lf %lf %lf", &x, &y, &z);
- delete [] str;
- if (scanned == 3) {
- mModel->AddDot(x, y, z);
- }
- }
- }
-
- void
- V3DDocModel::Store()
- {
-
- }
-